10. Errors

Errors

00:00
00:00

Which errors do we want to minimize?

SOLUTION:
  • Distance of vehicle from trajectory.
  • Difference of vehicle orientation and trajectory orientation.

We can capture how the errors we are interested in change over time by deriving our kinematic model around these errors as our new state vector.

The new state is [x,y,ψ,v,cte,eψ] [x, y, \psi, v, cte, e\psi] .

Let’s assume the vehicle is traveling down a straight road and the longitudinal direction is the same as the x-axis.

Cross Track Error

We can express the error between the center of the road and the vehicle's position as the cross track error (CTE). The CTE of the successor state after time t is the state at t + 1, and is defined as:

ctet+1=ctet+vtsin(eψt)dt cte_{t+1} = cte_t + v_t* sin(e\psi_t) * dt

In this case ctet cte_t can be expressed as the difference between the line and the current vehicle position y . Assuming the reference line is a 1st order polynomial f , f(xt) f(x_t) is our reference line and our CTE at the current state is defined as:

ctet=f(xt)yt cte_t = f(x_t) - y_t

If we substitute ctet cte_t back into the original equation the result is:

ctet+1=f(xt)yt+(vtsin(eψt)dt) cte_{t+1} = f(x_t) - y_t + (v_t * sin(e\psi_t) * dt)

This can be broken up into two parts:

  1. f(xt)yt f(x_t) - y_t being current cross track error.
  2. vtsin(eψt)dt v_t * sin(e\psi_t) * dt being the change in error caused by the vehicle's movement.

Orientation Error

Ok, now let’s take a look at the orientation error:

eψt+1=eψt+vtLfδtdt e\psi_{t+1} = e\psi_t + \frac{v_t} { L_f} * \delta_t * dt

The update rule is essentially the same as ψ \psi .

eψt e\psi_t is the desired orientation subtracted from the current orientation:

eψt=ψtψdest e\psi_t = \psi_t - \psi{des}_t

We already know ψt \psi_t , because it’s part of our state. We don’t yet know ψdest \psi{des}_t (desired psi) - all we have so far is a polynomial to follow. ψdest \psi{des}_t can be calculated as the tangential angle of the polynomial f evaluated at xt x_t , arctan(f(xt)) arctan(f'(x_t)) . f f' is the derivative of the polynomial.

eψt+1=ψtψdest+(vtLfδtdt) e\psi_{t+1} = \psi_t - \psi{des}_t + (\frac{v_t} { L_f} * \delta_t * dt)

Similarly to the cross track error this can be interpreted as two parts:

  1. ψtψdest \psi_t - \psi{des}_t being current orientation error.
  2. vtLfδtdt \frac{v_t} { L_f} * \delta_t * dt being the change in error caused by the vehicle's movement.

The dashed white line is the cross track error.

The dashed white line is the cross track error.